package com.bj58.mis.apm.server.kylin.model;

import java.util.Date;
import java.util.List;

public class Cube {
    private String uuid;
    private Long last_modified;
    private String version;
    private String name;
    private String owner;
    private String descriptor;
    private String display_name;
    private String status;
    private Long create_time_utc;
    private String cuboid_bytes;
    private String cuboid_bytes_recommend;
    private String cuboid_last_optimized;

    private String last_build_job_id;

    private List<Segment> segments;

    private Date d_last_modified;
    private Date d_create_time_utc;
    private Project project;
    private CubeDesc cubeDesc;

    public Cube(){}

    public Cube deal(){
        Long max = 0L;
        for (Segment seg : segments) {
            seg.deal();
            seg.setCube(this);

            if (seg.getLast_build_time() > max) {
                max = seg.getLast_build_time();
                this.last_build_job_id = seg.getLast_build_job_id();
            }
        }

        this.d_last_modified = new Date(this.last_modified);
        this.d_create_time_utc = new Date(this.create_time_utc);

        return this;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Long getLast_modified() {
        return last_modified;
    }

    public void setLast_modified(Long last_modified) {
        this.last_modified = last_modified;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getDescriptor() {
        return descriptor;
    }

    public void setDescriptor(String descriptor) {
        this.descriptor = descriptor;
    }

    public String getDisplay_name() {
        return display_name;
    }

    public void setDisplay_name(String display_name) {
        this.display_name = display_name;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getCreate_time_utc() {
        return create_time_utc;
    }

    public void setCreate_time_utc(Long create_time_utc) {
        this.create_time_utc = create_time_utc;
    }

    public String getCuboid_bytes() {
        return cuboid_bytes;
    }

    public void setCuboid_bytes(String cuboid_bytes) {
        this.cuboid_bytes = cuboid_bytes;
    }

    public String getCuboid_bytes_recommend() {
        return cuboid_bytes_recommend;
    }

    public void setCuboid_bytes_recommend(String cuboid_bytes_recommend) {
        this.cuboid_bytes_recommend = cuboid_bytes_recommend;
    }

    public String getCuboid_last_optimized() {
        return cuboid_last_optimized;
    }

    public void setCuboid_last_optimized(String cuboid_last_optimized) {
        this.cuboid_last_optimized = cuboid_last_optimized;
    }

    public String getLast_build_job_id() {
        return last_build_job_id;
    }

    public void setLast_build_job_id(String last_build_job_id) {
        this.last_build_job_id = last_build_job_id;
    }

    public List<Segment> getSegments() {
        return segments;
    }

    public void setSegments(List<Segment> segments) {
        this.segments = segments;
    }

    public Date getD_last_modified() {
        return d_last_modified;
    }

    public void setD_last_modified(Date d_last_modified) {
        this.d_last_modified = d_last_modified;
    }

    public Date getD_create_time_utc() {
        return d_create_time_utc;
    }

    public void setD_create_time_utc(Date d_create_time_utc) {
        this.d_create_time_utc = d_create_time_utc;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public CubeDesc getCubeDesc() {
        return cubeDesc;
    }

    public void setCubeDesc(CubeDesc cubeDesc) {
        this.cubeDesc = cubeDesc;
    }
}
